package com.java47.service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.java47.mapper.PostingMapper;
import com.java47.mapper.ReplyMapper;
import com.java47.pojo.Posting;
import com.java47.pojo.Reply;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class PostingServiceImpl implements PostingService{

    @Autowired
    private PostingMapper pmapper;
    @Autowired
    private ReplyMapper rmapper;

    @Override
    public List<Reply> showRlist(String pid) {
        return rmapper.showRlist(pid);
    }

    @Override
    public int add(Map<String, Object> map) {
        return rmapper.add(map);
    }

    @Override
    public Page showPage(Integer index,Integer size,String str) {
        Page<Object> page = PageHelper.startPage(index,size);
        List<Posting> list = pmapper.showPlist(str);
        return page;
    }
}
